package cn.wolfcode.crm.web.controller;

import cn.wolfcode.crm.domain.CompensationInfo;
import cn.wolfcode.crm.mapper.CompensationInfoMapper;
import cn.wolfcode.crm.service.ICompensationInfoService;
import cn.wolfcode.crm.util.JsonResult;
import cn.wolfcode.crm.util.PermissionName;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

//审核表
@Controller
@RequestMapping("checkClaim")
public class CheckClaimController {

    @Autowired
    private ICompensationInfoService iCompensationInfoService;

    @RequestMapping("")
    @PermissionName("审核表")
    @RequiresPermissions("checkClaim:index")
    public String index(){
        return "checkClaim/list";
    }

    //根据事故id查询赔偿表
    @RequestMapping("selectByaccidentId")
    @PermissionName("赔偿明细表查询")
    @RequiresPermissions("checkClaim:selectByaccidentId")
    @ResponseBody
    private CompensationInfo selectByaccidentId(Long accidentId){

        return  iCompensationInfoService.selectByaccidentId(accidentId);
    }

    //根据事故id查询赔偿表返回jsonresult
    @RequestMapping("selectcompensationinfoByaccidentId")
    @ResponseBody
    public JsonResult  selectcompensationinfoByaccidentId(Long accidentId){
        JsonResult result=new JsonResult();
        CompensationInfo compensationInfo = iCompensationInfoService.selectByaccidentId(accidentId);
        if(compensationInfo ==null){
            result.markMsg("请编写的你赔偿明细");
            return result;
        }
        return result;
    }


}
